package matrix;

public class CSimpleCell implements ICell {
	private int m_iRow;
	private int m_iColumn;
	private IRange m_oParent;

	public CSimpleCell(IRange aParent, int aRow, int aColumn) {
		if (aParent == null) {
			throw new IllegalArgumentException("aParent can't be null");
		}
		if ((aRow < 1) || (aColumn < 1) ) {
			throw new IllegalArgumentException("aRow, aColumn, aRows, aColumns can't be < 1");
		}
		if ((aRow > aParent.rows()) || (aColumn > aParent.columns()) ) {
			throw new IllegalArgumentException("aRow (aColumn) can't be > aParent.rows() (aParent.columns())");
		}
		this.m_oParent = aParent;
		this.m_iRow = aRow;
		this.m_iColumn = aColumn;
	}

	@Override
	public int row() {
		return m_iRow;
	}

	@Override
	public int column() {
		return m_iColumn;
	}

	@Override
	public void clear() {
		throw new UnsupportedOperationException("CSimpleCell.clear is not implemented");
	}

	public IRange parent() {
		return m_oParent;
	}

}
